package 力扣日常刷题.木22二月.第18天224;

import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * @author 帅小伙
 * @date 2022/2/25
 * @description
 * 优先队列
 * 找到最大值
 */
public class Demo147字节跳动2017后端工程师实习生笔试题2 {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Long n = scanner.nextLong();
        PriorityQueue<Long> queue = new PriorityQueue<>((a,b)->Long.compare(b,a));

        int sum = 0;
        for (int i = 0; i < n; i++) {
            Long op = scanner.nextLong();
            Long len = scanner.nextLong();
            if(op == 1) {
                sum += len;
                System.out.println("队列");
                queue.forEach(System.out::println);
                queue.add(len);
                Long peek = queue.peek();
                System.out.println(peek +" " + sum);
                if(peek >= sum - peek) System.out.println("No");
                else System.out.println("Yes");
            }else {
                Long  peek = queue.peek();
                sum -= len;
                if(len == peek){
                    queue.remove();
                }
                peek = queue.peek();
                if(peek >= sum - peek) System.out.println("No");
                else System.out.println("Yes");
            }

        }
    }
}
